package com.sky.mapper;

import com.sky.annotation.AutoFill;
import com.sky.entity.User;
import com.sky.enumeration.OperationType;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;

@Mapper
public interface UserMapper {
    /**
     * 通过openId获取User对象
     * @param openId
     * @return
     */
    @Select("select * from user where openid = #{openId}")
    public User getByOpenId(String openId);

    /**
     * 创建新用户
     * @param loginUser
     */
    void save(User loginUser);

    /**
     * 通过id查找用户
     * @param userId
     * @return
     */
    @Select("select * from user where id = #{userId}")
    User getById(Long userId);


    /**
     * 查询用户总数
     * @param begin
     * @param end
     * @return
     */
    Integer sumTotalUserByTime(LocalDateTime begin,LocalDateTime end);
}
